// @author A0096579E

package rightnow.util;

import java.util.Comparator;

import rightnow.storage.Task;

/**
 * DoneComparator imposes ordering of Tasks based on their isDone attribute.
 * A Task that is NOT done comes before one that is.
 */
public class DoneComparator implements Comparator<Task> {

	@Override
	public int compare(Task taskA, Task taskB) {
		if (taskA.isDone() && !taskB.isDone()) {
			return 1;
		} else if (!taskA.isDone() && taskB.isDone()) {
			return -1;
		} else { // if both tasks are done or undone
			return 0;
		}
	}

}
